#!/usr/bin/env python
# -*- coding: utf-8 -*-

# @Time     :2020/08/24
# @Author   :Changshu
# @File     :practice_104.py
# 104. 二叉树的最大深度


class Solution:
    def maxDepth(self, root: TreeNode) -> int:
        if root == None:
            return 0
        else:
            leftDepth=self.maxDepth(root.left)
            rightDepth=self.maxDepth(root.right)
            return max(leftDepth,rightDepth)+1
# 还可以使用队列进行层次遍历